package com.example.rocketmqdemo.transaction.adapter;

import com.alibaba.cola.dto.Response;
import com.example.rocketmqdemo.transaction.client.AccountAppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController
public class AccountController {

    @Autowired
    private AccountAppService accountAppService;

    @RequestMapping("/transfer")
    public Response transfer(@RequestParam(name = "amount", defaultValue = "100") BigDecimal amount) {
        return accountAppService.transfer(amount);
    }

}
